package com.yang.factory;

import com.yang.factory.impl.BayerischeMotorenWerke;
import com.yang.factory.impl.Porsche;
import com.yang.factory.impl.SGMW;

public class CarFactory {


    public static Car getCar(String name) {
        Car car;
        switch (name) {
            case "porsche":
                car = new Porsche();
                break;
            case "sgmw":
                car = new SGMW();
                break;
            case "bmw":
                car = new BayerischeMotorenWerke();
                break;
            default:
                car = () -> System.out.println("创建了一辆二手车");
                break;

        }
        return car;
    }


}
